﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            Text1();
        }
        static void Text()
        {
            //打印九九乘法表
            String[,] arr = new String[9, 9];
            for (int i = 0; i < arr.GetLength(0); i++)
            {
                for (int j = 0; j <= i; j++)
                {

                    arr[i, j] = (i + 1) + "*" + (j + 1) + "=" + (i + 1) * (j + 1) + "\t";
                }
            }
            for (int i = 0; i < arr.GetLength(0); i++)
            {
                for (int j = 0; j <= i; j++)
                {
                    Console.Write(arr[i, j]);

                }
                Console.WriteLine();
            }
            Console.ReadLine();
        }

        //用户输入正方形边长，用* 打印出实心正方形。

        //如：用户输入5，则输出如下图形。
        //*****
        //*****
        //*****
        //*****
        //*****
        static void Text1()
        {
            Console.WriteLine("请输入正方形的长");
            int a = int.Parse(Console.ReadLine());
            String[,] b = new String[a, a];
            for (int i = 0; i < b.GetLength(0); i++)
            {
                for (int j = 0; j < b.GetLength(1); j++)
                {
                    b[i, j] = "*";
                }
            }
            for (int i = 0; i < b.GetLength(0); i++)
            {
                for (int j = 0; j < b.GetLength(1); j++)
                {
                    Console.Write(b[i, j]);
                }
                Console.WriteLine();
            }
            Console.ReadKey();

        }
   //用户输入正方形边长，用* 打印出空心正方形。

    //如：用户输入5，则输出如下图形。
    //*****
    //*     *
    //*     *
    //*     *
    //*****
        static void Text2()
        {
            Console.WriteLine("请输入正方形的边长:");
            int a = int.Parse(Console.ReadLine());

            string[,] arr = new string[a, a];

            for (int i = 0; i < arr.GetLength(0); i++)
            {
                for (int j = 0; j < arr.GetLength(1); j++)
                {
                    arr[i, j] = "*";
                }
            }
            for (int i = 0; i < arr.GetLength(0); i++)
            {
                for (int j = 0; j < arr.GetLength(1); j++)
                {
                    if (i == 0 || j == 0 || i == arr.GetLength(0) - 1 || j == arr.GetLength(1) - 1)
                    {
                        Console.Write(arr[i, j]);
                    }
                    else
                    {
                        Console.Write(" ");
                    }
                }
                Console.WriteLine();
            }
            Console.ReadKey();
        }
    }
}